<?php
/*-------------------------------------------------------+
| PHP-Fusion Content Management System
| Copyright (C) 2002 - 2011 Nick Jones
| http://www.php-fusion.co.uk/
+--------------------------------------------------------+
| Filename: latest_news_panel.php
| Author: jikaka
+--------------------------------------------------------+
| This program is released as free software under the
| Affero GPL license. You can redistribute it and/or
| modify it under the terms of this license which you
| can read by viewing the included agpl.txt or online
| at www.gnu.org/licenses/agpl.html. Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
+--------------------------------------------------------*/
if (!defined("IN_FUSION")) { die("Access Denied"); }

if (file_exists(INFUSIONS."latest_news_panel/locale/".$settings['locale'].".php")) {
		include INFUSIONS."latest_news_panel/locale/".$settings['locale'].".php";
	} else {
		include INFUSIONS."latest_news_panel/locale/English.php";
	}

openside($locale['news001']);
$result = dbquery("SELECT * FROM ".DB_PREFIX."news WHERE ".groupaccess('news_visibility')." AND (news_start='0'||news_start<=".time().") AND (news_end='0'||news_end>=".time().") ORDER BY news_datestamp DESC LIMIT 0,5");
if (dbrows($result)) {
	echo "<table width='100%' cellpadding='0' cellspacing='0' border='0'>\n";
	while($data = dbarray($result)) {
		$cell_color = ($i % 2 == 0 ? "tbl2" : "tbl"); $i++;
		$itemsubject = trimlink($data['news_subject'], 50);
		echo "<tr>\n<td class='".$cell_color."'><img src='".THEME."images/bullet.gif' alt='' /> <a href='".BASEDIR."news.php?readmore=".$data['news_id']."' title='".$data['news_subject']."' class='side'>$itemsubject</a></td>\n";
	}
	echo "</table>\n";
} else {
	echo "<div style='text-align:center'>".$locale['news002']."</div>\n";
}
closeside();
?>